package com.edu.service.impl;

import com.edu.domin.dto.CommentDTO;
import com.edu.entity.Comment;
import com.edu.mapper.CommentMapper;
import com.edu.service.ICommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 文章评论表 服务实现类
 * </p>
 *
 * @author author
 * @since 2025-05-15
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements ICommentService {

    @Override
    public void savenew(Long articleId, Long userId, CommentDTO commentDTO) {
        Comment comment = new Comment();
        //  设置文章id
        comment.setArticleId(articleId);
        // 设置用户id
        comment.setUserId(userId);
        comment.setContent(commentDTO.getContent());
        save(comment);
    }
}
